package com.dmz.resold.apartment.service;

import com.dmz.resold.apartment.csp.CspQueryJob;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author lee
 */
@Slf4j
@Component
public class SendReqJob implements Job {
    public static String bankID = "104";
    public static String url = "";
    public static String lsh = "";
    private static CspQueryJob cspa;

    @Autowired
    private Handler handler;

    @Override
    public void execute(JobExecutionContext arg0) throws JobExecutionException {
        //获取上一个处理的流水号并处理
        cspa = new CspQueryJob();
        String result;
        try {
            result = cspa.getLastLSH("20190221");
            lsh = result.split("\\|")[1];//上一次处理的流水号

            log.info("------------------------[DMZ->房管局]--------------------------------------");
            log.info("银行ID:" + bankID);
            log.info("上一次办理的流水号LSH:" + lsh);

            //获取房管局指令文件
            String newLSH = handler.getCommand(bankID, lsh, url);
        } catch (Exception e) {
            log.error("获取流水异常:" , e);
        }
    }
}